package com.lishuang.basic.util;


/**
 * 数据库操作结果封装类
 */
public class AjaxResult {

    //操作结果
    public Boolean success = true;
    //提示信息
    public String message = "操作成功";

    public Object resultObj;

    public static AjaxResult me() {
        return new AjaxResult();
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;

    }

    public AjaxResult() {
    }

    public AjaxResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    @Override
    public String toString() {
        return "AjaxResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                '}';
    }

    //测试链式语法
    public static void main(String[] args) {
        System.out.println(AjaxResult.me().setSuccess(false).setMessage("操作失败"));
    }
}
